import storage from './helper/DATA/localstorage'
const { ccclass, property } = cc._decorator;
export const MapEntryType = {
    '1': 'math',
    '2': 'letter'
}
@ccclass
export default class Home extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        // 预加载场景
        cc.director.preloadScene('math')
        cc.director.preloadScene('letter')
    }
    start() {
        cc.log(this.node)
    }

    // update (dt) {}
    gameEntry(event: any, id: string) {
        if (MapEntryType[id]) {
            cc.director.loadScene(MapEntryType[id])
            storage.set('currentGame', id)
        }
    }
}
